package com.skyable.account.handler.sentinel;

import com.alibaba.csp.sentinel.slots.block.BlockException;
import com.skyable.common.common.ResponseResult;
import com.skyable.common.constants.exception.CommonExcpConstants;

/**
 * @author GaoYuan
 * @title: UserSentinelHandler
 * @projectName spring-cloud-demo
 * @description: TODO
 * @date 2021/3/2112:07
 */
public class UserSentinelHandler {

    public static ResponseResult sentinelBlock(Integer id, BlockException exception) {
        return ResponseResult.error(CommonExcpConstants.ERROR_CODE, "sentinel block, id " + id + ", occur exception:" + exception);
    }

    public static ResponseResult sentinelFallBack(Integer id, Throwable exception) {
        return ResponseResult.error(CommonExcpConstants.ERROR_CODE, "sentinel fallback, id " + id + ", occur exception:" + exception);
    }
}
